<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/12/10
 * Time: 9:58
 */

header("Content-Type: text/html;charset=utf-8");
header("Access-Control-Allow-Origin:*");

include "status.php";
include "config.php";

if($_SERVER["REQUEST_METHOD"] != "POST"){
    print_r(json_encode(Status::$r_0));
    return;
}

if(isset($_REQUEST["uname"]) && isset($_REQUEST["upwd"])){
    $UNAME = $_REQUEST["uname"];
    $UPWD = $_REQUEST["upwd"];


    $sql = "insert into sasauserinfo (u_name,u_pwd)values(?,?); ";

    $stmt = $conn->prepare($sql);
    $stmt->bind_param("ss", $UNAME, $UPWD);

    $stmt->execute();

    if($stmt->affected_rows >= 1){
        print_r(json_encode(Status::$r_success));
    } else {
        print_r(json_encode(Status::$r_error));
    }

    $stmt->close();
    $conn->close();
} else {
    print_r(json_encode(Status::$r_1));
}

